
---------------------------------------------------------------
File name   :  vv_ahblite_slave_sequence_h.e
Title       :  Sequence interface for active slave agents
Project     :  vv_ahblite eVC
Developers  :  stefan,filip
Created     :  
Description :  This file declares the sequence interface of the slave.
Notes       :  Only active slave agents have a sequence interface.
---------------------------------------------------------------
Copyright  (c)2011
---------------------------------------------------------------

<'

package vv_ahblite;

sequence vv_ahblite_slave_sequence using
  item = SLAVE vv_ahblite_transaction,
  created_driver = vv_ahblite_slave_driver_u,
  created_kind = vv_ahblite_slave_sequence_kind_t;

extend vv_ahblite_slave_driver_u {

    p_env : vv_ahblite_env;
    env_name : vv_ahblite_env_name_t;
    p_slave : vv_ahblite_slave;
    slave_name : vv_ahblite_agent_name_t;
    !p_bus_monitor  : vv_ahblite_bus_monitor;
}; 

extend vv_ahblite_slave_sequence {

    slave_name : vv_ahblite_agent_name_t;
        keep slave_name == read_only(driver.slave_name);

    -- This is a utility field for basic sequences. This enables
    -- "do response ...".
    !response: SLAVE vv_ahblite_transaction;

}; 

-- This constrain slave transaction fields to
-- appropriate signals written by the slave
 extend vv_ahblite_transaction {
    when SLAVE {
    --code to be added for slave transaction
    
    	--keep soft ready == 1; 
    	keep soft response == 0; -- OK response without wait states
    	keep soft wait_states_num == 0;
    	
//	    keep soft ready == select {
//	    	0: 0; --30% casses add wait states
//	    	90: 1; --70% no wait state
//	    };
//	    
//	    keep soft response == select {
//	    	0: 1; -- error response
//	    	90: 0; -- OK response
//	    };
//	    
//	    
    	
//	    -----------------------new
//	    keep soft wait_states_num == select {
//	    	90: 0;
//	    	5: 1;
//	    	3: 2;
//	    	2: [4..16];
//	    };
	    ----------------------new
	    
	    --@@@ we can add a field that defines if there should be wait states or error states
	    
	    
	    keep addr == get_address();
	    keep write_op == get_write_op();
	    keep burst == get_burst();
	    keep lock == get_lock();
	    keep protect == get_protect();
	    keep transfer == get_transfer();
	    keep data_size == get_data_size();
	    keep gen (driver) before (addr, write_op, burst, lock, transfer, data_size, protect);
	    
	    keep (transfer in [BUSY, IDLE]) => ready == 1;
	    keep (transfer in [BUSY, IDLE])	=> response == 0;
	    keep gen (transfer) before (ready, response);
	        
	    get_my_driver() : vv_ahblite_slave_driver_u is {
	        result = driver;
	    };
	    get_address() : vv_ahblite_addr_t is {
	    	result = get_my_driver().p_bus_monitor.transaction.addr;
	    };
	    get_write_op() : bit is {
	    	result = get_my_driver().p_bus_monitor.transaction.write_op;
	    };
	    get_burst() : vv_ahblite_burst_t is {
	    	result = get_my_driver().p_bus_monitor.transaction.burst;
	    };
	    get_lock() : bit is {
	    	result = get_my_driver().p_bus_monitor.transaction.lock;
	    };
	    get_protect() : uint (bits : 4) is {
	    	result = get_my_driver().p_bus_monitor.transaction.protect;
	    };
	    get_transfer() : vv_ahblite_transfer_t is {
	    	result = get_my_driver().p_bus_monitor.transaction.transfer;
	    };
	    get_data_size() : vv_ahblite_data_size_t is {
	        result = get_my_driver().p_bus_monitor.transaction.data_size;
	    };
	    --@@@ adittional get methods might be added
	      
 	};
};


extend MAIN vv_ahblite_slave_sequence {

    -- The slave sequence driver is a reactive sequence driver.
    -- This sets its default to never runs out of sequence items.
    keep soft count == MAX_UINT;
    
    
}; 

'>

